/**
 * In me the tiger sniffs the rose.
 *
 * @Author:徐家政
 * @Date:2019-04-17 19:22
 */
package com.shiyu.demo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shiyu.demo.mapper.PostListMapper;
import com.shiyu.demo.service.PostListService;
import com.shiyu.demo.util.ResultData;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PostListServiceImpl implements PostListService {
    @Resource
    private PostListMapper postListMapper;
    @Override
    public ResultData getpostList(int offset) {
        int limit=9;
        PageHelper.offsetPage(offset,limit);
        List list=postListMapper.getPostList();
        PageInfo info=new PageInfo(list);
        long total=info.getTotal();
        List list1=info.getList();
        ResultData resultData=new ResultData(total,list1);
        return resultData;
    }
}
